using Shinkansen.Core;
using Shinkansen.Runtime;

namespace Shinkansen.Model
{
    public class QueryStringForJavaScriptBuilder : IQueryStringBuilder
    {
        private readonly IQueryStringBuilder _builder;

        /// <summary>
        /// Initializes a new instance of the <see cref="QueryStringForJavaScriptBuilder"/> class.
        /// </summary>
        /// <param name="builder">The builder.</param>
        public QueryStringForJavaScriptBuilder (IQueryStringBuilder builder)
        {
            _builder = builder;
        }

        /// <summary>
        /// Builds the specified query string.
        /// </summary>
        /// <param name="queryString">The query string.</param>
        public void ConstructQueryString (QueryString queryString)
        {
            _builder.ConstructQueryString (queryString);
            queryString[Tokens.FileType] = Tokens.JavaScript;
        }
    }
}